package com.qcby.service;

import com.qcby.entity.*;
import com.qcby.entity.Query.ShopQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ShopService {
     List<ShopSTag> findTag();

    PageResult<Shop> list(ShopQuery shopQuery);

    void deleteById(Integer id);

    Shop findById(Integer id);
    List<ShopQuery> findAll(Shop shop);

    List<Tag> findTags();

    List<Shop> selectShopByTag(String tagName);

    Shop goToDetail(Integer id);
    Result<Integer> like(@Param("targetId") Integer targetId, @Param("userId") Integer userId);

    Result<Integer> likeStatus(@Param("targetId") Integer targetId, @Param("userId") Integer userId);

    Result<Integer> likeCount(@Param("targetId") Integer targetId, @Param("target_type")String target_type);

    Result<Integer> likeDelete(@Param("targetId") Integer targetId,
                               @Param("userId") Integer userId,
                               @Param("target_type")String target_type);
    //List<Review> getReviewsByShopId(Integer id);


    List<User> findUserList();

    void add(Shop shop);

    void updateById(Shop shop);


    Result<Integer> rating(        @Param("shopId") Integer shopId,
                                   @Param("userId") Integer userId,
                                   @Param("rating") Integer rating);

    Result<Integer> ratingCount(    @Param("shopId") Integer shopId,@Param("userId") Integer userId);

    Result<Double> getRecent100RatingsAverage(Integer shopId);

    Result<Integer> updateShopRatingStatus();

    Result<Integer> addReview(Review review);


    List<Shop> findAll1();

    Result<List<Review>> getReplies(Integer reviewId);

    Result<Integer> likeReview(@Param("targetId") Integer targetId,
                               @Param("userId") Integer userId);

    Result<Integer> syncReviewLikeCount(Integer count);

    Integer cancelReviewLike(@Param("targetId") Integer targetId,
                             @Param("userId") Integer userId,
                             @Param("target_type")String target_type);

    List<Shop> findByPage(@Param("query") ShopQuery query,  // 命名为 "query"，与 XML 中的 query 匹配
                          @Param("start") int start,        // 命名为 "start"，与 XML 中的 start 匹配
                          @Param("pageSize") int pageSize );

    int countByQuery(ShopQuery query);

    PageResult<Review> getShopReviews(Integer shopId, Integer page, Integer pageSize);

    List<Shop> getShopsByUserId(Integer userId);

    List<Shop> getShopsByUserName(String userName);

    Shop getShopsByAduit(Integer id);
}
